<?php
class mailLayer {
	public static function send(OTS_Account $acc, $subject, $text_body) {
		require("lib/class.phpmailer.php");
		$mail = new PHPMailer();

		$mail->From = configLayer::get('smtp_mail');
		$mail->FromName = configParser::getData('servername') . " AAC";
		$mail->Host = configLayer::get('smtp_host');
		$mail->Mailer = "smtp";
		$mail->Username = configLayer::get('smtp_username');
		$mail->Password = configLayer::get('smtp_password');
		$mail->SMTPAuth = true;
		$mail->Subject = $subject;

		$mail->Body = $text_body;
		$mail->AddAddress($acc->eMail,'');

		if(!$mail->Send()) {
			return false;
		}

		$mail->ClearAddresses();
		$mail->ClearAttachments();

		return true;
	}
}
?>